package com.xbongbong.admin.model.impl;

import com.xbongbong.admin.domain.dao.AppInstallDao;
import com.xbongbong.admin.domain.entity.AppInstallEntity;
import com.xbongbong.admin.model.AppInstallModel;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.util.DateUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 应用安装
 * @author xingxing.xiao
 * @date 2020/01/09 16:01
 */
@Service("appInstallModel")
public class AppInstallModelImpl implements AppInstallModel {

    @Resource
    private AppInstallDao appInstallDao;

    @Override
    public Integer insert(AppInstallEntity entity) throws XbbException {
        long now = DateUtil.getInt();
        entity.setAddTime(now);
        entity.setUpdateTime(now);
        return appInstallDao.insert(entity);
    }

    @Override
    public Integer update(AppInstallEntity entity) throws XbbException {
        long now = DateUtil.getInt();
        entity.setUpdateTime(now);
        return appInstallDao.update(entity);
    }

    @Override
    public List<AppInstallEntity> findEntitys(Map<String, Object> param) {
        return appInstallDao.findEntitys(param);
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return appInstallDao.getEntitysCount(param);
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }

    @Override
    public AppInstallEntity getByMirrorId(Long mirrorId, String corpid) {
        return appInstallDao.getByMirrorId(mirrorId, corpid);
    }

    @Override
    public Integer deleteByKey(Long key, String corpid) {
        return appInstallDao.deleteByKey(key, corpid);
    }

    @Override
    public AppInstallEntity getByAppId(Long appId, String corpid) {
        return appInstallDao.getByAppId(appId, corpid);
    }

    @Override
    public Integer updateBatch(List<AppInstallEntity> appInstallEntityList) {
        return appInstallDao.updateBatch(appInstallEntityList);
    }

    @Override
    public AppInstallEntity getByKey(Long key, String corpid) {
        return appInstallDao.getByKey(key, corpid);
    }

    @Override
    public AppInstallEntity getByKeyIgnoreCorpid(Long key) {
        return appInstallDao.getByKeyIgnoreCorpid(key);
    }

}
